package cn.codeforfun.modules.main;

import cn.codeforfun.modules.user.add.AddController;
import cn.codeforfun.modules.user.list.ListController;
import cn.codeforfun.shared.AbstractFrameController;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;

@Controller
@AllArgsConstructor
public class MainController extends AbstractFrameController {
    MainFrame mainFrame;
    AddController addController;
    ListController listController;

    @Override
    public void prepareAndOpenFrame() {
        registerAction(mainFrame.getAddButton(), e -> addController.prepareAndOpenFrame());
        registerAction(mainFrame.getListButton(), e -> listController.prepareAndOpenFrame());
        mainFrame.setVisible(true);
    }

}
